/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sirtet.tetris.program;

import java.io.IOException;
import sirtet.netplay.server.GameCommunity;
import sirtet.netplay.server.GameRoomFactory;
import sirtet.netplay.server.Receptionist;
import sirtet.tetris.TetrisQualifierRoomFactory;
import sirtet.tetris.TetrisRoomFactory;

/**
 * For test: run the Tetris Server
 * @author guangwei.zhu
 */
public class TetrisServer {

    public static void main(String[] args) throws IOException {
        Receptionist gate;
        GameCommunity community;
        GameRoomFactory factory;

        community = new GameCommunity();

        // For VS-Battle tetris games ("tetris" mode)
        factory = new TetrisRoomFactory();
        community.registerFactory(factory);

        // For qualifier ("tetris-qualifier" mode)
        factory = new TetrisQualifierRoomFactory();
        community.registerFactory(factory);

        gate = new Receptionist(9462);
        gate.addHandler(community);
        gate.beginWait();
    }
}
